<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<base href="<%=basePath%>">
<title>项目管理系统 </title>
<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
}
.tabfont01 {	
	font-family: "宋体";
	font-size: 9px;
	color: #555555;
	text-decoration: none;
	text-align: center;
}
.font051 {font-family: "宋体";
	font-size: 12px;
	color: #333333;
	text-decoration: none;
	line-height: 20px;
}
.font201 {font-family: "宋体";
	font-size: 12px;
	color: #FF0000;
	text-decoration: none;
}
.button {
	font-family: "宋体";
	font-size: 14px;
	height: 37px;
}
html { overflow-x: auto; overflow-y: auto; border:0;} 
-->
</style>

<link href="jsp/skin/css/css.css" rel="stylesheet" type="text/css" />
<link href="jsp/skin/css/style.css" rel="stylesheet" type="text/css" />
<script language="javascript" src="js/jquery-1.7.2.min.js"></script>
<script language="javascript" src="js/jquery-ui-1.8.22.custom.min.js"></script>
<script type="text/JavaScript">
$(document).ready(function(){
 $("#searchButton").bind("click",function(){
     alert("查询");
     $("#curPage").val(1);
     document.searchForm.action = "tblAdvertAddressAct!searchByPage.action";
     document.searchForm.submit();
 });
  $("#addButton").bind("click",function(){
     alert("增加");
     document.searchForm.action = "jumptoAdvertAddress.action";
     document.searchForm.submit();

 });
   $("#deleteButton").bind("click",function(){
     alert("删除");
     document.searchForm.action = "tblAdvertAddressAct!deleteAdvertAddress.action";
     document.searchForm.submit();

 });

});
function searchUpdate(id){
  document.searchForm.action = "tblAdvertAddressAct!searchUpdateAdvertAddress.action?tblAdvertAddressVo.id=" + id;
  document.searchForm.submit();
}
function changePage(butFlg){
  var curPage = parseInt($("#curPage").val());
  var total = $("#total").val();
  if(butFlg==1){
     if(curPage==1){
       alert("当前已是首页！");
       return;
     }
     $("#curPage").val(1);
  }else if(butFlg==2){
     if(curPage==1){
       alert("当前已是第一页！");
       return;
     }
     $("#curPage").val(curPage-1);
  }else if(butFlg==3){
     if(curPage==total){
       alert("当前已是最后页！");
       return;
     }
     $("#curPage").val(curPage+1);
  }else if(butFlg==4){
     if(curPage==total){
       alert("当前已是末页！");
       return;
     }
     $("#curPage").val(total);
  }else if(butFlg==5){
     var re=/\d{1,}/;
     if(re.test($("#goTo").val())==false){
        alert("请输入数字！");
        return;
     }
     var num=parseInt($("#goTo").val());
     if(num>total||num<1){
       alert("页面输入不合理！");
       return;
     }
     $("#curPage").val(num);
  }
  document.searchForm.action = "tblAdvertAddressAct!searchByPage.action";
  document.searchForm.submit();
}
</script>

</head>
<body onload="javascript:initPage();">
<s:form name="searchForm" id="searchForm" method="post" action="">
<s:hidden name="tblAdvertAddressVoQuery.curPage" id="curPage"></s:hidden>
<s:hidden name="tblAdvertAddressVoQuery.total" id="total"></s:hidden>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr width="100%">
     <table>
       <tr width="100%">
          <td>广告位名:
          </td>
          <td><s:textfield theme="simple" name="tblAdvertAddressVoQuery.advertName" id="tblAdvertAddressVo.advertName" /></td>
          <td>默认广告类型：</td>
          <td><s:action name="codeAct!findDefCode" id="defCode"></s:action>
             <s:select theme="simple" name="tblAdvertAddressVoQuery.defType" 
                          listKey="code" listValue="value" list="#defCode.tbldeftypeList"/></td>
          <td align="right" width="50%"><input type="button" id="searchButton" name="searchButton" value="查询" />
              <input type="button" id="addButton" name="addButton" value="增加" />
              <input type="button" id="deleteButton" name="deleteButton" value="删除" />
              
          </td>
       </tr>
     </table>

      </tr>
      <tr>
        <td height="40" class="font42">
	       <table width="100%" border="0" cellpadding="4" cellspacing="1" bgcolor="#464646" class="newfont03">
		      <tr class="CTitle" >
                <td height="22" colspan="8" align="center" style="font-size:16px">任务详细列表</td>
              </tr>
              <tr bgcolor="#EEEEEE">
			     <td width="4%" align="center" height="30">编号</td>
                 <td width="9%">广告名称</td>
			     <td width="9%">广告大小</td>
                 <td width="9%">默认广告类型</td>
				 <td width="9%">默认广告地址</td>
				 <td width="20%">备注</td>
				 <td width="5%">操作</td>
				 <td width="5%">选择</td>
               </tr>
               <s:iterator value="tblAdvertAddressVoList" status="nowIndex">
                <tr bgcolor="#FFFFFF">
				    <td height="20">${(nowIndex.index+1)+(tblAdvertAddressVoQuery.curPage-1)*sizePerPage}</td>
                    <td><s:property value="%{advertName}" /></td>
					<td><s:property value="%{width}"/>*<s:property value="%{height}" /></td>
                    <td><s:property value="%{defTypeValue}" /></td>
                    <td><s:property value="%{defPath}" /></td>
                    <td><s:property value="%{notes}" /></td>
                    <td><a href="javascript:searchUpdate(<s:property value="%{id}" />)">修改</a></td>
					<td><s:checkbox name="selectedId" id="selectedId" fieldValue="%{id}" theme="simple" /></td>
                 </tr>
				</s:iterator>
            </table></td>
        </tr>
      </table>
      <table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
        <tr>
          <td height="6"><img src="jsp/skin/images/spacer.gif" width="1" height="1" /></td>
        </tr>
        <tr>
          <td height="33"><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" class="right-font08">
              <tr>
                <td width="50%">共 <span class="right-text09"><s:property value="%{tblAdvertAddressVoQuery.total}" /></span> 页 | 第 <span class="right-text09"><s:property value="%{tblAdvertAddressVoQuery.curPage}" /></span> 页</td>
                <td width="49%" align="right">[<a href="javascript:changePage(1);" class="right-font08">首页</a> | <a href="javascript:changePage(2);" class="right-font08">上一页</a> | <a href="javascript:changePage(3);" class="right-font08">下一页</a> | <a href="javascript:changePage(4);" class="right-font08">末页</a>] 转至：</td>
                <td width="1%"><table width="20" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td width="1%"><input name="goTo" id="goTo" type="text" class="right-textfield03" size="1" /></td>
                      <td width="87%"><input name="button" type="submit" class="right-button06" value="Go" onclick="javascript:changePage(5);" />
                      </td>
                    </tr>
                </table></td>
              </tr>
          </table></td>
        </tr>
      </table>
</s:form>
</body>
</html>

